package com.heima.article.controller.v1;


import com.heima.article.service.ApAuthorService;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wemedia.pojos.WmUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/article/api/v1/author")
@Api(value = "文章发布权限管理",tags = "文章发布权限管理")
public class ApAuthorController {

    @Autowired
    private ApAuthorService apAuthorService;

    @ApiOperation("根据id查找作者")
    @GetMapping("/findByUserId/{id}")
    public ResponseResult findAuthorByUserId(@PathVariable Integer id) {
        return apAuthorService.findAuthorById(id);
    }

    @ApiOperation("新增作者")
    @PostMapping("/save")
    public ResponseResult saveAuthor(@RequestBody ApAuthor apAuthor) {
        return apAuthorService.saveAuthor(apAuthor);
    }




}
